\subsection{Statement and proof}
\begin{definition}
    A category \( \mathcal C \) is called \emph{locally small} if the collection of morphisms \( A \to B \) are parametrised by a set.
    In this case, we write \( \mathcal C(A, B) \) for the set of such morphisms.
\end{definition}
Given an object \( A \) of a locally small category, we can define a functor
\[ \mathcal C(A, -) : \mathcal C \to \mathbf{Set} \]
given by
\[ B \mapsto \mathcal C(A, B);\quad (B \xrightarrow f C) \mapsto ((A \xrightarrow g B) \mapsto f g) \]
This is functorial by associativity of function composition.
We can also define
\[ \mathcal C(-, A) : \mathcal C^\cop \to \mathbf{Set} \]
by
\[ B \mapsto \mathcal C(B, A);\quad (B \xrightarrow f C) \mapsto ((B \xrightarrow g A) \mapsto g f) \]
\begin{lemma}[Yoneda lemma]
    Let \( \mathcal C \) be a locally small category.
    Let \( A \in \ob \mathcal C \), and let \( F : \mathcal C \to \mathbf{Set} \) be a functor.
    Then,
    \begin{enumerate}
        \item there is a bijection
        \[ \qty{\text{natural transformations } \mathcal C(A, -) \to F} \leftrightarrow \qty{\text{elements of } F A} \]
        \item and further, this bijection is natural in both \( A \) and \( F \).
    \end{enumerate}
\end{lemma}
This shows that we can consider a natural transformation \( \mathcal C(A, -) \to F \) as a way to evaluate morphisms at a point \( x \in F A \).
% Example: consider the category on A, B, C with morphisms A -> A, A -> B, A -> C
\begin{example}
    Consider the category \( \mathcal C \) of the form
    \[\begin{tikzcd}
        & A \\
        B && C
        \arrow["f"', from=1-2, to=2-1]
        \arrow["g", from=1-2, to=2-3]
    \end{tikzcd}\]
    and the functor \( F : \mathcal C \to \mathbf{Set} \) given by
    \[ F(A) = \qty{1, 2}; \quad F(B) = \qty{3};\quad F(C) = \qty{4, 5, 6} \]
    and
    \[ F(f)(1) = F(f)(2) = 3;\quad F(g)(1) = 4;\quad F(g)(2) = 5 \]
    A natural transformation \( \alpha : \mathcal C(A, -) \to F \) is given by its components
    \[ \alpha_A : \qty{1_A} \to \qty{1, 2};\quad \alpha_B : \qty{f} \to \qty{3};\quad \alpha_C : \qty{g} \to \qty{4, 5, 6} \]
    subject to the naturality square
    \[\begin{tikzcd}
        {\qty{1_A}} & {\qty{g}} \\
        {\qty{1, 2}} & {\qty{4, 5, 6}}
        \arrow["{\mathcal C(A, g)}", from=1-1, to=1-2]
        \arrow["{\alpha_C}", from=1-2, to=2-2]
        \arrow["{\alpha_A}"', from=1-1, to=2-1]
        \arrow["Fg"', from=2-1, to=2-2]
    \end{tikzcd}\]
    which enforces that
    \[ (Fg)(\alpha_A) = \alpha_C(g) \]
    This means that such a natural transformation \( \alpha \) is defined uniquely by a choice of \( (Fg)(\alpha_A) \); that is, a choice of an element of \( FA \).
\end{example}
% Example: represent a group as a set with its composition operation
\begin{example}
    Let \( G \) be a group in the set-theoretic sense.
    Let us represent \( G \) as the category \( \mathcal C \); that is, let
    \[ \ob \mathcal C = \qty{\star};\quad \mor \mathcal C = G \]
    Consider the functor \( F : \mathcal C \to \mathbf{Set} \) given by
    \[ F(\star) = G;\quad F(g)(h) = gh \]
    If \( \alpha : \mathcal C(\star, -) \to F \) is a natural transformation, for each \( g \in G \), \( \alpha_\star(g) \) is a map \( G \to G \).
    The naturality condition ensures that \( \alpha \) respects the group structure.
    Applying the Yoneda lemma, we find that every map \( G \to G \) that respects the group structure in this way is just the action of multiplication by some element of the group.
\end{example}
We prove part (i) now, and postpone (ii) until some corollaries have been established.
\begin{proof}
    We want to show that a natural transformation \( \alpha : \mathcal C(A, -) \to F \) is a way to evaluate morphisms at a point \( x \in F A \).
    To find a sensible value for \( x \), we evaluate the identity morphism \( 1_A : A \to A \).
    \[ \Phi : (\mathcal C(A, -) \to F) \to F A;\quad \Phi(\alpha) = \alpha_A(1_A) \in F A \]
    Now, given a point \( x \in F A \), we want to create a natural transformation that evaluates functions \( A \to B \) and yields a point in \( F B \).
    We define
    \[ \Psi : F A \to (\mathcal C(A, -) \to F);\quad \Psi(x)_B(A \xrightarrow f B) = (F f)x \]
    % This is natural as \( F \) is a functor:
    For \( h : B \to C \), the naturality square is as follows.
    \[\begin{tikzcd}
        {\mathcal C(A, B)} & {\mathcal C(A, C)} \\
        FB & FC
        \arrow["{\mathcal C(A, h)}", from=1-1, to=1-2]
        \arrow["{\Psi(x)_C}", from=1-2, to=2-2]
        \arrow["{\Psi(x)_B}"', from=1-1, to=2-1]
        \arrow["Fh"', from=2-1, to=2-2]
    \end{tikzcd}\]
    Here, \( \mathcal C(A, h) \) denotes the operation \( g \mapsto hg \).
    For \( f : A \to B \),
    \[ \Psi(x)_C(\mathcal C(A, h)(f)) = \Psi(x)_C (hf) = (F (hf))x \]
    and
    \[ (Fh)(\Psi(x)_B(f)) = (Fh)((Ff)x) = (F (hf))x \]
    as required.
    Hence the `evaluate at \( x \)' map \( \Psi(x) \) is a natural transformation.
    We show that these two constructions are inverses.
    \[ \Phi \Psi(x) = \Psi(x)_A (1_A) = (F 1_A) x = 1_{F A} x = x \]
    Let \( \alpha : \mathcal C(A, -) \to F \) be a natural transformation, let \( B \in \ob \mathcal C \), and let \( f : A \to B \).
    Then \( \alpha_B(f) \) and \( (\Psi \Phi(\alpha))_B (f) \) are elements of \( F B \); we show they coincide.
    \[ (\Psi \Phi(\alpha))_B (f) = (F f) (\Phi(\alpha)) = (F f) (\alpha_A (1_A)) \]
    Naturality of \( \alpha \) shows that the following diagram commutes.
    \[\begin{tikzcd}
        {\mathcal C(A, A)} & {\mathcal C(A, B)} \\
        FA & FB
        \arrow["{\mathcal C(A, f)}", from=1-1, to=1-2]
        \arrow["{\alpha_B}", from=1-2, to=2-2]
        \arrow["{\alpha_A}"', from=1-1, to=2-1]
        \arrow["Ff"', from=2-1, to=2-2]
    \end{tikzcd}\]
    Thus,
    \[ (\Psi \Phi(\alpha))_B (f) = \alpha_B (f 1_A) = \alpha_B (f) \]
    Hence, \( \Phi \) and \( \Psi \) are inverse bijections.
\end{proof}
\begin{corollary}
    For any locally small category \( \mathcal C \), the map
    \[ A \mapsto \mathcal C(A, -) \]
    is a full and faithful functor
    \[ Y : \mathcal C^\cop \to [\mathcal C, \mathbf{Set}] \]
    This is called the \emph{Yoneda embedding}.
\end{corollary}
\begin{proof}
    Let \( F = \mathcal C(B, -) \) in the Yoneda lemma.
    Then there is a bijection
    \[ \mathcal C(B, A) \leftrightarrow \qty{\text{natural transformations } \mathcal C(A, -) \to \mathcal C(B, -)} \]
    This bijection maps \( f : B \to A \) to the natural transformation given by composition with \( f \).
    This is functorial as composition in \( \mathcal C \) is associative.
\end{proof}
This says that any locally small category \( \mathcal C \) is equivalent to a full subcategory of a functor category \( [\mathcal C^\cop, \mathbf{Set}] \).
The category \( [\mathcal C^\cop, \mathbf{Set}] \) is sometimes called the category of \emph{presheaves} on \( \mathcal C \), so any category embeds into its category of presheaves.

We now explain and prove part (ii) of the Yoneda lemma.
Suppose that \( \mathcal C \) were small, so \( [\mathcal C, \mathbf{Set}] \) were locally small.
Then we have two functors
\[ \mathcal C \times [\mathcal C, \mathbf{Set}] \to \mathbf{Set} \]
The first is the evaluation functor
\[ (A, F) = FA \]
The second is the composite
\[ \mathcal C \times [\mathcal C, \mathbf{Set}] \xrightarrow{Y \times 1} [\mathcal C, \mathbf{Set}]^\cop \times [\mathcal C, \mathbf{Set}] \xrightarrow{[\mathcal C, \mathbf{Set}](-, -)} \mathbf{Set} \]
The naturality condition is that \( \Phi \) and \( \Psi \) are natural transformations between these two functors, and thus are natural isomorphisms.
\begin{proof}
    Let \( f : A \to A' \), \( \alpha : F \to F' \), and \( x \in F A \).
    If \( x' \) is the image of \( x \) under the diagonal of the naturality square
    \[\begin{tikzcd}
        FA & {FA'} \\
        {F'A} & {F'A'}
        \arrow["Ff", from=1-1, to=1-2]
        \arrow["{\alpha_{A'}}", from=1-2, to=2-2]
        \arrow["{\alpha_A}"', from=1-1, to=2-1]
        \arrow["{F'f}"', from=2-1, to=2-2]
    \end{tikzcd}\]
    we want to show that \( \Psi(x') \) is the composite
    \[ \mathcal C(A', -) \xrightarrow{\mathcal C(f, -)} \mathcal C(A, -) \xrightarrow{\Psi(x)} F \xrightarrow \alpha F' \]
    But this can be easily verified, as the composite maps
    \[ 1_{A'} \mapsto f \mapsto (Ff)(x) \mapsto \alpha_{A'}(Ff)(x) = x' \]
    as required.
\end{proof}

\subsection{Representable functors}
\begin{definition}
    Let \( \mathcal C \) be a locally small category.
    A functor \( F : \mathcal C \to \mathbf{Set} \) is called \emph{representable} if it is isomorphic to \( \mathcal C(A, -) \) for some \( A \).
    A \emph{representation} of \( F \) is a pair \( (A, x) \) where \( A \in \ob \mathcal C \), and \( x \in FA \) is such that
    \[ \Psi(x) : \mathcal C(A, -) \to F \]
    is a natural isomorphism.
    In this case, we say that \( x \) is a \emph{universal element} of \( F \).
\end{definition}
\begin{corollary}
    Suppose \( (A, x) \) and \( (B, y) \) are representations of \( F : \mathcal C \to \mathbf{Set} \).
    Then there is a unique isomorphism \( f : A \to B \) such that \( Ff(x) = y \).
\end{corollary}
\begin{proof}
    The Yoneda lemma shows that the elements of \( F A \) correspond to natural transformations \( \mathcal C(A, -) \to F \), and similarly for the elements of \( F B \).
    Thus, \( Ff(x) = y \) equivalently says that
    \[\begin{tikzcd}
        {\mathcal C(B, -)} && {\mathcal C(A, -)} \\
        & F
        \arrow["{\mathcal C(f, -)}", from=1-1, to=1-3]
        \arrow["{\Psi(x)}", from=1-3, to=2-2]
        \arrow["{\Psi(y)}"', from=1-1, to=2-2]
    \end{tikzcd}\]
    commutes.
    But \( \Psi(x) \) and \( \Psi(y) \) are isomorphisms, so this holds if and only if \( f \) is the unique isomorphism sent by the Yoneda embedding to \( \Psi(x)^{-1} \Psi(y) \).
\end{proof}
\begin{enumerate}
    \item Consider the forgetful functor \( \mathbf{Gp} \to \mathbf{Set} \).
    This is representable by the free group on one generator, \( \mathbb Z \).
    Similarly, the forgetful functor \( \mathbf{Rng} \to \mathbf{Set} \) is represented by the free ring on one generator, \( \mathbb Z[x] \).
    \item The forgetful functor \( \mathbf{Top} \to \mathbf{Set} \) is representable by the one-point space.
    \item The contravariant power set functor \( P^\star : \mathbf{Set}^\cop \to \mathbf{Set} \) is representable by the two-element set \( 2 = \qty{0, 1} \) via the bijection mapping \( f : A \to 2 \) to \( f^{-1}(1) \).
    \item The covariant power set functor \( P : \mathbf{Set} \to \mathbf{Set} \) is not representable.
    \( \mathbf{Set}(A, 1) \cong 1 \) for any \( A \), but \( P 1 \cong 2 \ncong 1 \).
    \item Define \( \Omega : \mathbf{Top}^\cop \to \mathbf{Set} \) to be the functor mapping a space \( X \) to its set of open subsets.
    If \( f : X \to Y \) is continuous, this induces a map \( \Omega f : \Omega Y \to \Omega X \).
    This is representable by the \emph{Sierpi\'nski space} \( \Sigma \) with two points \( \qty{0, 1} \) and open sets
    \[ \varnothing;\quad \qty{1};\quad \Sigma \]
    The continuous maps \( f : X \to \Sigma \) are exactly the characteristic functions of the open subsets of \( X \), because continuity is just that \( f^{-1}(\qty{1}) \) is open.
    \item The dual vector space functor \( (-)^\star : \mathbf{Vect}_k^\cop \to \mathbf{Vect}_k \) is not representable because its codomain is not \( \mathbf{Set} \), but composing with the forgetful functor makes it representable by the one-dimensional space \( k \).
    \item Let \( G \) be a group.
    The (unique up to isomorphism) representable functor \( G \to \mathbf{Set} \) is the \emph{Cayley representation} of the group; that is, the set \( G \) acting on itself by multiplication.
    \item Let \( A, B \) be objects of a locally small category \( \mathcal C \).
    Then there is a functor \( \mathcal C^\cop \to \mathbf{Set} \) sending \( C \) to the Cartesian product
    \[ \mathcal C(C, A) \times \mathcal C(C, B) \]
    If this is representable, we call the representing object a categorical \emph{product} of \( A \) and \( B \), and denote it \( A \times B \).
    The universal element is a pair of morphisms \( \pi_1 : A \times B \to A, \pi_2 : A \times B \to B \), called \emph{projections}.
    This has the property that for any pair \( (f : C \to A, g : C \to B) \) there exists a unique morphism \( h = (f, g) : C \to A \times B \) satisfying \( \pi_1 h = f, \pi_2 h = g \).
    \item Dually, there is the notion of a \emph{coproduct} \( A + B \), which is a representing object of the functor mapping \( C \) to
    \[ \mathcal C(A, C) \times \mathcal C(B, C) \]
    with \emph{coprojections} \( \nu_1 : A \to A + B, \nu_2 : B \to A + B \).
    \item Let \( f, g : A \rightrightarrows B \) be a parallel pair of morphisms in a locally small category \( \mathcal C \).
    Define a functor \( F : \mathcal C^\cop \to \mathbf{Set} \) by sending \( C \) to
    \[ \qty{h : C \to A \mid fh = gh} \]
    If this is representable, we call the representation an \emph{equaliser} of \( f \) and \( g \).
    This consists of a representing object \( E \) with a morphism \( e : E \to A \) satisfying \( fe = ge \).
    Moreover, for any morphism \( h \) with \( fh = gh \), \( h \) factors uniquely through \( e \).
    Hence, \( e \) is a monomorphism.
    Monomorphisms that occur in this way are called \emph{regular}.
    \item Dually, there is also a notion of coequaliser, giving rise to an epimorphism.
    We again epimorphisms \emph{regular} if they arise in this way.
\end{enumerate}
In \( \mathbf{Set} \), the categorical product is the Cartesian product, and the categorical coproduct is the disjoint union.
The equaliser of \( f, g : A \rightrightarrows B \) is the set
\[ \qty{a \in A \mid fa = ga} \]
The coequaliser of \( f, g \) is the quotient
\[ \faktor{B}{\sim} \]
where \( \sim \) is the equivalence relation generated by \( fa \sim ga \).

In \( \mathbf{Gp} \), the product is the direct product, but the coproduct is the \emph{free product} \( A \ast B \).
The equaliser of \( f, g : A \rightrightarrows B \) is as in \( \mathbf{Set} \), which is a subgroup of \( A \).
The coequaliser of \( f, g \) is the quotient by the smallest congruence containing all pairs \( (fa, ga) \).
In \( \mathbf{Set} \) and \( \mathbf{Gp} \), all monomorphisms and epimorphisms are regular.

In \( \mathbf{Top} \), not all injections or surjections are regular monomorphisms or epimorphisms.

\subsection{Separating and detecting families}
\begin{definition}
    Let \( \mathcal C \) be a locally small category, and \( \mathcal G \) a class of objects of \( \mathcal C \).
    We say that
    \begin{enumerate}
        \item \( \mathcal G \) is a \emph{separating family} for \( \mathcal C \) if the functors \( \mathcal C(G, -) \) for \( G \in \mathcal G \) are collectively faithful; that is, if \( f, g : A \rightrightarrows B \), the equations \( fh = gh \) for all \( h : G \to A \) with \( G \in \mathcal G \) imply \( f = g \).
        \[\begin{tikzcd}
            G & A & B
            \arrow["h", from=1-1, to=1-2]
            \arrow["f", shift left=2, from=1-2, to=1-3]
            \arrow["g"', shift right=2, from=1-2, to=1-3]
        \end{tikzcd}\]
        \item \( \mathcal G \) is a \emph{detecting family} for \( \mathcal C \) if the functors \( \mathcal C(G, -) \) for \( G \in \mathcal G \) collectively \emph{reflect isomorphisms}; that is, if \( f : A \to B \) is such that every \( h : G \to B \) with \( G \in \mathcal G \) factors uniquely through \( A \), then \( f \) is an isomorphism.
        \[\begin{tikzcd}
            G & A \\
            & B
            \arrow["g", dashed, from=1-1, to=1-2]
            \arrow["f", from=1-2, to=2-2]
            \arrow["h"', from=1-1, to=2-2]
        \end{tikzcd}\]
    \end{enumerate}
    If \( \mathcal G = \qty{G} \), we call \( G \) a \emph{separator} or \emph{detector} respectively.
\end{definition}
Separating and detecting families are both sometimes called \emph{generating families}.
\begin{lemma}
    \begin{enumerate}
        \item If \( \mathcal C \) has equalisers, then any detecting family is separating.
        \item If \( \mathcal C \) is balanced, then any separating family is detecting.
    \end{enumerate}
\end{lemma}
\begin{proof}
    \emph{Part (i).}
    Suppose \( \mathcal G \) is detecting, and \( f, g : A \rightrightarrows B \) such that every morphism \( h : G \to A \) with \( G \in \mathcal G \) has \( fh = gh \).
    Then every such \( h : G \to A \) with \( G \in \mathcal G \) factors uniquely through the equaliser of \( f \) and \( g \).
    \[\begin{tikzcd}
        G \\
        E & A & B
        \arrow["h", from=1-1, to=2-2]
        \arrow["f", shift left=2, from=2-2, to=2-3]
        \arrow["g"', shift right=2, from=2-2, to=2-3]
        \arrow["e"', from=2-1, to=2-2]
        \arrow[dashed, from=1-1, to=2-1]
    \end{tikzcd}\]
    Thus this equaliser \( e \) must be an isomorphism as \( \mathcal G \) is detecting.
    Since \( ef = eg \), we must have \( f = g \), as required.

    \emph{Part (ii).}
    Suppose \( \mathcal G \) is separating, and \( f : A \to B \) is such that every \( h : G \to B \) with \( G \in \mathcal G \) factors uniquely through \( f \).
    As \( \mathcal C \) is balanced, it suffices to show that \( f \) is both monic and epic.

    If \( fg = fh \) for some \( g, h : C \rightrightarrows A \), then any \( k : G \to C \) with \( G \in \mathcal G \) satisfies \( gk = hk \), since both are factorisations of \( fgk = fhk \) through \( f \).
    \[\begin{tikzcd}
        G & C & A & B
        \arrow["g", shift left=2, from=1-2, to=1-3]
        \arrow["h"', shift right=2, from=1-2, to=1-3]
        \arrow["k", from=1-1, to=1-2]
        \arrow["f", from=1-3, to=1-4]
    \end{tikzcd}\]
    Since \( \mathcal G \) is separating, \( g = h \).
    As this is true for all pairs \( g, h \), we must have that \( f \) is monic.

    Similarly, if \( \ell, m : B \rightrightarrows D \) satisfy \( \ell f = mf \), then any \( n : G \to B \) with \( G \in \mathcal G \) satisfies \( \ell n = m n \), since it factors through \( f \).
    \[\begin{tikzcd}
        & G \\
        A & B & D
        \arrow["\ell", shift left=2, from=2-2, to=2-3]
        \arrow["m"', shift right=2, from=2-2, to=2-3]
        \arrow["f"', from=2-1, to=2-2]
        \arrow["n", from=1-2, to=2-2]
        \arrow[dashed, from=1-2, to=2-1]
    \end{tikzcd}\]
    So \( \ell = m \), giving that \( f \) is epic.
\end{proof}
\begin{example}
    \begin{enumerate}
        \item In \( \mathbf{Gp} \), the forgetful functor is represented by \( \mathbb Z \).
        This functor is faithful and reflects isomorphisms, so it is a separator and a detector.
        \item In \( \mathbf{Rng} \), the forgetful functor is represented by \( \mathbb Z[x] \), so similarly \( \mathbb Z[x] \) is a separator and a detector.
        \item If \( \mathcal C \) is small, the set \( \qty{\mathcal C(A, -) \mid A \in \ob \mathcal C} \) is a separating and detecting set for \( [\mathcal C, \mathbf{Set}] \) by the Yoneda lemma.
        \item In \( \mathbf{Top} \), the one-point space \( 1 \) is a separator, but \( \mathbf{Top} \) has no detecting set.
        If \( \kappa \) is an infinite cardinal, let \( X_\kappa \) be a discrete space of cardinality \( \kappa \), and let \( Y_\kappa \) be the same set with the co-\( < \kappa \) topology:
        \[ U \text{ open} \iff U = \varnothing \text{ or } \abs{Y_\kappa \setminus U} < \kappa \]
        The identity \( X_\kappa \to Y_\kappa \) is continuous but not a homeomorphism.
        Given any set \( \mathcal G \) of spaces, if \( \kappa \) is larger than \( \abs{G} \) for all \( G \in \mathcal G \), then \( \mathcal G \) cannot detect the fact that the map \( X_\kappa \to Y_\kappa \) is not a homeomorphism.
        \item Let \( \mathcal C \) be the category whose objects are the (von Neumann) ordinals, and in addition to the identity morphisms, there are precisely two morphisms \( f, g : \alpha \rightrightarrows \beta \) when \( \alpha < \beta \).
        We define composition in such a way that \( ff = fg = gf = gg = f \).
        Now, \( 0 \) is a detector for \( \mathcal C \): it detects that \( f, g : 0 \rightrightarrows \alpha \) are not isomorphisms, as neither factors through the other, and it detects that \( f, g : \alpha \rightrightarrows \beta \) are not isomorphisms for \( 0 < \alpha < \beta \) since the morphism \( g : 0 \to \beta \) does not factor through either of them.
        There is no separating set for \( \mathcal C \): for any set of ordinals \( \mathcal G \), if \( \alpha > \gamma \) for all \( \gamma \in \mathcal G \), \( \mathcal G \) cannot separate \( f, g : \alpha \rightrightarrows \alpha + 1 \).
        \item \( \mathbf{Gp} \) has no \emph{coseparating} or \emph{codetecting} set of objects.
        Given any set \( \mathcal G \) of groups, let \( H \) be a simple group with cardinality greater than that of each element of \( \mathcal G \).
        Then the only homomorphisms from \( H \) to elements of \( \mathcal G \) are trivial.
        In particular, \( \mathcal G \) cannot detect that the map \( H \to 1 \) is not an isomorphism.
    \end{enumerate}
\end{example}

\subsection{Projectivity}
The functors \( \mathcal C(A, -) : \mathcal C \to \mathbf{Set} \) preserve monomorphisms.
They do not, in general, preserve epimorphisms.
\begin{definition}
    We say that an object \( P \) of a locally small category \( \mathcal C \) is \emph{projective} if \( \mathcal C(P, -) \) preserves epimorphisms.
    In more elementary terms, given a diagram
    % https://q.uiver.app/#q=WzAsMyxbMSwwLCJQIl0sWzEsMSwiUiJdLFswLDEsIlEiXSxbMCwxLCJmIl0sWzIsMSwiZyIsMix7InN0eWxlIjp7ImhlYWQiOnsibmFtZSI6ImVwaSJ9fX1dXQ==
\[\begin{tikzcd}
	& P \\
	Q & R
	\arrow["f", from=1-2, to=2-2]
	\arrow["g"', two heads, from=2-1, to=2-2]
\end{tikzcd}\]
    there exists \( h : P \to Q \) such that \( gh = f \).
    % https://q.uiver.app/#q=WzAsMyxbMSwwLCJQIl0sWzEsMSwiUiJdLFswLDEsIlEiXSxbMCwxLCJmIl0sWzIsMSwiZyIsMix7InN0eWxlIjp7ImhlYWQiOnsibmFtZSI6ImVwaSJ9fX1dLFswLDIsImgiLDIseyJzdHlsZSI6eyJib2R5Ijp7Im5hbWUiOiJkYXNoZWQifX19XV0=
\[\begin{tikzcd}
	& P \\
	Q & R
	\arrow["f", from=1-2, to=2-2]
	\arrow["g"', two heads, from=2-1, to=2-2]
	\arrow["h"', dashed, from=1-2, to=2-1]
\end{tikzcd}\]
    If this holds for all \( g \) in some class \( \mathcal E \) of epimorphisms, we say that \( P \) is \( \mathcal E \)-projective.
    The dual notion is called \emph{injectivity}.
\end{definition}
We will consider the class of pointwise epimorphisms in \( [\mathcal C, \mathbf{Set}] \); that is, those natural transformations \( \alpha \) whose components \( \alpha_A \) are surjective.
\begin{corollary}
    Objects of the form \( \mathcal C(A, -) \) are pointwise projective in \( [\mathcal C, \mathbf{Set}] \).
\end{corollary}
\begin{proof}
    If \( P = \mathcal C(A, -) \), an \( f \) in the above diagram corresponds to some \( \Phi(f) \in RA \) by the Yoneda lemma.
    But \( g_A \) is surjective, so there exists \( \Phi(h) \in QA \) mapping to \( \Phi(f) \).
\end{proof}
\begin{proposition}
    If \( \mathcal C \) is small, then \( [\mathcal C, \mathbf{Set}] \) has \emph{enough pointwise projectives}; that is, for any object \( F \) there exists a pointwise epimorphism \( P \to F \) with \( P \) pointwise projective.
\end{proposition}
\begin{proof}
    Let \( P = \coprod_{(A, x)} \mathcal C(A, -) \) where the disjoint union is taken over all pairs \( (A, x) \) with \( A \in \ob \mathcal C \) and \( x \in FA \).
    % any coproduct of projectives is projective
    Then \( P \) is pointwise projective, since the \( \mathcal C(A, -) \) are.
    There is a natural transformation \( \alpha : P \to F \) where the \( (A, x) \)-indexed term is \( \Psi(x) : \mathcal C(A, -) \to F \).
    This is pointwise epic, since any \( x \in FA \) is in the image of \( \Psi(x) \). 
\end{proof}
